import request from '@/utils/request'

export function getTaskSetting() {
  return request({
    url: '/task/taskSettings',
    method: 'get'
  })
}

  export function getUserInfobyPage(page = null, size = null, orgIds = null, stationIds = null) {
    if (stationIds) {
      stationIds=stationIds.toString()
    }
    return request({
      url: '/user/getPageInfos',
      method: 'get',
      params: { page, size, orgIds, stationIds }
    })
  }



  export function getDeviceInfobyPage(page = null, size = null, deviceType = null, orgIds = null, stationIds = null) {
    if (stationIds) {
      stationIds=stationIds.toString()
    }
    return request({
      url: '/device/getPageInfos',
      method: 'get',
      params: { page, size, deviceType, orgIds, stationIds },
    })
  }



export function getUserGroupInfobyPage(page = null, size = null, isTemp = 0) {
    return request({
      url: '/group/getPageInfos',
      method: 'get',
      params: { page, size, groupType: 1 }
    })
  }


export function getDeviceGroupInfobyPage(page = null, size = null, isTemp = 0) {
  return request({
    url: '/group/getPageInfos',
    method: 'get',
    params: { page, size, groupType: 2 }
  })
}


export function getTaskBriefList(data) {
  return request({
    url: '/task/taskBriefList',
    method: 'get',
    params:data
  })
}

export function postSkyLightTime(data) {
  return request({
    url: '/task/checkAndSetWindowTime',
    method: 'post',
    params:data
  })
}
// export function getTaskBriefList(userId = 1, deviceId = 1,state,station,fenceStation) {
//     return request({
//       url: '/task/taskBriefList',
//       method: 'get',
//       params: { userId, deviceId,state,station,fenceStation }
//     })
//   }

  export function postTaskInfo(taskinfo) {
    return request({
      url: '/task/taskCreate',
      method: 'post',
      data:taskinfo
    })
  }


  export function updateTaskInfo(taskId,taskinfo) {
    return request({
      url: '/task/update',
      method: 'put',
      data:taskinfo,
      params: { taskId }
    })
  }


  export function deleteTaskInfo(taskId) {
    return request({
      url: '/task/delete',
      method: 'delete',
      params: { taskId }
    })
  }

  export function putTaskOperate(taskId,operType) {
    return request({
      url: '/task/operate',
      method: 'put',
      params: { taskId },
      data:{operType:operType}
    })
  }


  export function   getTaskInfo(taskId) {
    return request({
      url: '/task/taskInfo',
      method: 'get',
      params: { taskId }
    })
  }


  export function   getImagePaths(taskId) {
    return request({
      url: '/pic/getImagePaths',
      method: 'get',
      params: { taskId }
    })
  }


  export function   getLineData() {
    return request({
      url: '/linedata/getLineData',
      method: 'get',
    })
  }

  export function   getSectionData() {
    return request({
      url: '/linedata/getSectionData',
      method: 'get',
    })
  }


  export function postfenceTrack(data) {
    return request({
      url: '/electric-fence/track',
      method: 'post',
      data:data
    })
  } 



  export function getPermission(userId,permType) {
    return request({
      url: '/permission/getInfo',
      method: 'get',
      params: { userId,permType }
    })
  } 

  export function getInfo(id) {
    return request({
      url: '/user/getInfo',
      method: 'get',
      params: { userId: id }
    })
  }


  export function manualWarn(data) {
    return request({
      url: '/manualWarn/operate',
      method: 'post',
      data:data
    })
  }

  export function fenceGenerate(data) {
    return request({
      url: '/electric-fence/fenceGenerate',
      method: 'post',
      data:data
    })
  }